
// ChildFrm.h : interface of the CChildFrame class
//

#pragma once

#include "PanePropertyGrid.h"
#include "VisionGraphDoc.h"
#include "VisionGraphView.h"
#include "VisionWrapper.h"

CXTPPropertyGrid& GetPropertyGrid(CWnd* pFrame = 0);

class CChildFrame : public CMDIChildWnd
{
	DECLARE_DYNCREATE(CChildFrame)
public:
	CChildFrame();

// Attributes
public:
	
	CXTPDockingPaneManager m_paneManager;
	CXTPDockingPaneManager* GetDockingPaneManager() {
		return &m_paneManager;
	}	
	CPanePropertyGrid m_panePropertyGrid;
	CXTPPropertyGridUpdateContext m_stateExpanding;
	BOOL m_bInUpdate;
	CVisionGraphView* m_pView;
	CXTPOfficeBorder<CXTPTaskPanel> m_wndTaskPanel;
// Operations
public:

// Overrides
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);

// Implementation
public:
	virtual ~CChildFrame();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

// Generated message map functions
protected:
	DECLARE_MESSAGE_MAP()	
	afx_msg LRESULT OnDockingPaneNotify(WPARAM wParam, LPARAM lParam);	
	afx_msg LRESULT OnShortcutLBoxNotify(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnGridNotify(WPARAM wParam, LPARAM lParam);

	int  m_VisionNum;
public:
	void UpdatePropertyGridContent(CVisionGraphView* pView = NULL);
	void UpdatePropertyGridContent(ConfigWrapper* config);
public:

	// GetPropertyGrid
	inline CXTPPropertyGrid& GetPropertyGrid(CWnd* pFrame)
	{
		if (pFrame == 0) pFrame = AfxGetMainWnd();
		return ((CChildFrame*)pFrame)->m_panePropertyGrid.m_wndPropertyGrid;
	}
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	// CreateVisionWnd
	CWnd* CreateVisionWnd(void);
	// CreateVisionGroup
	CXTPTaskPanelGroup* CreateVisionGroup(UINT nID,const CString title);
	// ResetVisionItems
	void ResetVisionItems(void);
	// InitVisionConfig
	int InitVisionConfig(CMap<CString, LPCTSTR, CVisionWrapper*, CVisionWrapper*>&  m_Vision);
	virtual BOOL PreTranslateMessage(MSG* pMsg);
//	afx_msg void OnFileSave();
};
